/* eslint-disable no-sequences */
/*
 * @Descripttion:
 * @version:
 * @Author: QYFeng
 * @Date: 2021-04-19 22:28:37
 * @LastEditors: QYFeng
 * @LastEditTime: 2021-04-19 23:41:33
 */
import Vue from 'vue'
import App from './App.vue'
import router from './router'

// reset.css
import './assets/style/reset.css'

import './util/rem'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'

// 引入所有api
import API from './api/api'

import AmapVue from '@amap/amap-vue'
Vue.prototype.$http = API

Vue.use(ElementUI)
Vue.use(VueAwesomeSwiper)

AmapVue.config.key = 'cc384e30e87d259a1427b2b7d7a5a4ce'
Vue.use(AmapVue)

// 路由发生变化修改页面title
router.beforeEach((to, from, next) => {
  // console.log('tab', to.meta)
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

// 路由跳转页面回到顶部
router.afterEach((to, from, next, window) => {
  // eslint-disable-next-line no-unused-expressions
  window,
  scrollTo(0, 0)
})

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
